<!--#INCLUDE FILE="config.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../styles.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- DATE PICKER SCRIPT -->
<link type="text/css" href="../css/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.21.custom.min.js"></script>
<script>
	$(function() {
		$( "#arrival1" ).datepicker();
		$( "#departure1" ).datepicker();
		$( "#arrival2" ).datepicker();
		$( "#departure2" ).datepicker();
	});
	</script>
  <!-- END DATE PICKER SCRIPT -->


<!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> -->
<script type="text/javascript">
$(function() {
    $('#list_table tr:nth-child(2n+1)').addClass('alternate');
});
</script>
<script language="javascript" type="text/javascript">
function checkValidation()
{
	if(document.getElementById('arrival1').value =="")
	{
		alert("Enter start date");
		document.getElementById('arrival1').focus();
		return false;
	}
	return true;
}
</script>

<title>Admin Buscar Huesped :: Costa Baja</title>
</head>
<%
if(Session("AdminAccessLevel") <> 1 and Session("AdminAccessLevel") <> 3) then
	Response.Redirect("admin-login.asp?msg=invalid")
end if
									name = Cstr(Server.HTMLEncode(request("name"))) 
									mname =  Cstr(Server.HTMLEncode(request("mname")))
									sname =  Cstr(Server.HTMLEncode(request("sname")))
									city =  Cstr(Server.HTMLEncode(request("city")))								
									country =  Cstr(Server.HTMLEncode(request("country")))
									email =  Cstr(Server.HTMLEncode(request("email")))
									arrival1 =  Cstr(Server.HTMLEncode(request("arrival1")))
									propertyId_request =  Cstr(Server.HTMLEncode(request("property")))
									code =  Cstr(Server.HTMLEncode(request("code")))
%>
<body>

<div id="main_wrapper">
    	<div class="main_wrapper_margin">
        	
            <div class="admin_top_menu">
            <!--#INCLUDE FILE="admin_menu.asp"--> 
           	</div>
             
			<h1>Buscar Huesped</h1>         
           
           <div class="clear"></div>
          
         <form method="get" action="admin-guest-search.asp">
           <fieldset>
           	<legend>Informacion Personal</legend>
            <table cellpadding="0" width="100%">
            	
                <tr> <!-- ROW -->
                	<td width="33%">
            		<label>Nombre: </label><br />
					<input type="text" name="name" id="name"/>
  					</td>
                    <td width="33%">
                    <label>Segundo Nombre: </label><br />
                    <input type="text" name="mname" id="mname"/>
            		</td>
                    <td width="33%">
                    <label>Apellido: </label><br />
					<input type="text" name="sname" id="sname"/>
                    </td>
                </tr><!-- END ROW -->
                
                 <tr> <!-- ROW -->
                	<td width="33%">
            <label>Ciudad: </label><br />
                <input type="text" name="city" id="city"/>
  					</td>
                    <td width="33%">
                  <label>Pais: </label><br />
                <input type="text" name="country" id="country"/>
            		</td>
                    <td width="33%">
                    <label>E-mail: </label><br />
					<input type="text" name="email" id="email"/>
              
                    </td>
                </tr><!-- END ROW -->
                
            
                    
                <tr> <!-- ROW -->
                    <td>
           
            <label>Fecha de Llegada: </label><br />
                    <input type="text" id="arrival1" name="arrival1" />   
            		</td>
                    <td>
					
	<label>Propiedad: </label><br />
            			<select id="property" name="property">
						<option value="">-- Seleccionar --</option>
						<%
						sqlstring = "SELECT * FROM Propertys"

						set objConnect1 = server.createObject("ADODB.Connection")   

						objConnect1.Open conStr

						set TblTemp1 = server.createobject("Adodb.Recordset")
								
						TblTemp1.Open Sqlstring, objConnect1
						
						Do Until TblTemp1.EOF
							propertyId = TblTemp1("PropertyID")
							propertyName = TblTemp1("PropertyName")
					%>
			    		
            			<option value="<%=propertyId%>"><%=propertyName%></option>
						<%
						
							TblTemp1.MoveNext
						Loop

						%>
            			</select>
            		</td>
                    <td>
             		<label>CODIGO: </label><br />
            		<input type="text" id="code" name="code"/> 
                    </td>
                 </tr><!-- END ROW -->
                 
                 <tr><!-- ROW -->
                 <td colspan="3" align="center">
                 
                 <input type="submit"  value="Buscar" />
                 
                 </td>
                 </tr><!-- END ROW -->
           
            </table>
            
           </fieldset>
           
           </form>

	<h3>Resultados</h3>
    
    <table id="list_table" width="100%" border="0" cellspacing="0" cellpadding="5">
  <tr class="titles">
    <td>Fecha</td>
    <td>Nombre</td>
    <td>Segundo Nombre</td>
    <td>Aprellido</td>
    <td>Ciudad</td>
    <td>Pais</td>
    <td>Email</td>
      <td>&nbsp;</td>
  </tr>
  <%
														
		set objConnect = server.createObject("ADODB.Connection")       
		objConnect.open conStr
	
		Set oCmd = Server.CreateObject("ADODB.Command")
	  
		oCmd.ActiveConnection = objConnect
		oCmd.CommandText = "sp_search_guest" 
		oCmd.CommandType = 4
		
		Set Paraname = oCmd.CreateParameter("@name", 200,1,50,name)
		oCmd.Parameters.Append Paraname
		
		Set Paramname = oCmd.CreateParameter("@midname", 200,1,50,mname)
		oCmd.Parameters.Append Paramname														
		
		Set Parasname = oCmd.CreateParameter("@surname", 200,1,50, sname)
		oCmd.Parameters.Append Parasname
		
		Set Paracity = oCmd.CreateParameter("@city", 200,1,50, city)
		oCmd.Parameters.Append Paracity
		
		Set Paracountry = oCmd.CreateParameter("@country", 200,1,50, country)
		oCmd.Parameters.Append Paracountry
		
		Set Paraemail = oCmd.CreateParameter("@email", 200,1,50, email)
		oCmd.Parameters.Append Paraemail

		Set Paraarrivaldate = oCmd.CreateParameter("@arrivaldate", 200,1,50, arrival1)
		oCmd.Parameters.Append Paraarrivaldate
		
		Set ParapropertyId = oCmd.CreateParameter("@propertyId", 200,1,50, propertyId_request)
		oCmd.Parameters.Append ParapropertyId
		
		Set Paracode = oCmd.CreateParameter("@code", 200,1,50, code)
		oCmd.Parameters.Append Paracode
		
		set rss =Server.CreateObject("ADODB.RecordSet")
		set rss = oCmd.execute
		
		if not rss.eof then	
															
			while not rss.eof
		%>
  <tr>
    <td><%=rss("ActualArrival")%></td>
    <td><%=rss("Name")%></td>
    <td><%=rss("Middle")%></td>
    <td><%=rss("Surname")%></td>
    <td><%=rss("City")%></td>
    <td><%=rss("Country")%></td>
    <td><%=rss("Email")%></td>
    <td><a href="admin-guest-profile-page.asp?gId=<%=rss("GuestID")%>">Ver Detalles</a></td>
  </tr>
  <%
			
		rss.movenext
		wend
	else 
		%>
		<tr>
			<td colspan="10" class="list" align="center">No Guests found!</td>
		</tr>
		<%
		end if
		objConnect.close()
		set objConnect = Nothing
	%>
</table>
    
    
           
           
    	</div><!-- END .main_wrapper_margin -->
	</div><!-- END #main_wrapper -->
         <!-- FOOTER -->
         
         <!--#INCLUDE FILE="admin_footer.asp"-->
         
         <!-- END FOOTER -->   
</body>
</html>
